<template>
  <div class="">
    <el-select @change="getChildren" v-model="value" placeholder="children data">
      <el-option
        v-for="item in childOptions"
        :key="item.value"
        :label="item.label"
        :value="item.value">
      </el-option>
    </el-select>
  </div>
</template>
 
<script>

export default {
  name: '',
  props: {
    // 父组件通过 data->props 向下传递数据给子组件
    // 注：组件中的数据共有三种形式：data、props、computed
    childOptions: {
      type: Array,
      required: true,
      default() {
        return [
          {value: '选项1', label: 'label1'}
        ]
      }
    }
  },
  data () {
    return {
      value:'选项1'
    }
  },
  methods: {
    getChildren(v) {
      // console.log(v)
      //自定义事件  传递值“子向父组件传值”
      this.$emit('getChildren', v)
    }
  }
}
</script>
 
<style scoped lang="scss">
 
</style>